<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<body>
<h2 align="center">文件上传</h2>
<form id="myForm" enctype="multipart/form-data">
    文件：<input type="file" name="file" id="file" multiple/>
    <input type="button" value="上传"/>
</form>
<script>
    $(':button').on('click', function () {
        //构建formData封装表单数据
        let formData = new FormData($('#myForm')[0]);
        $.ajax({
            url: 'upload/images',
            type: 'post',
            data: formData,
            processData: false,
            contentType: false,
            success: function (result) {
                if (result.code == 200) {
                    alert("上传成功")
                }else{
                    alert("上传失败")
                }
            }
        })
    })
</script>
</body>
</html>